import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:vape_xe/services/services.dart';

class ForgetController extends GetxController with GetSingleTickerProviderStateMixin {
  /// 响应式成员变量
  final _isPhone = false.obs;

  set isPhone(value) => _isPhone.value = value;

  get isPhone => _isPhone.value;

  final _isChecked = false.obs;

  set isChecked(value) => _isChecked.value = value;

  get isChecked => _isChecked.value;

  /// 成员变量
  // tab 页标题
  late final List<String> tabTitles;
  late final TabController tabController;

  late String dialCode;
  late TextEditingController accountController;
  TextEditingController textEditingController = TextEditingController();

  @override
  void onInit() {
    super.onInit();
    // 准备一些静态数据
    tabTitles = ['Email'.tr, 'Phone number'.tr];
    tabController = TabController(length: tabTitles.length, vsync: this)
      ..addListener(() {
        isPhone = tabController.index == 1;
        accountController.clear();
        Get.focusScope?.unfocus();
      });

    dialCode = ConfigStore.to.countryCode;
    accountController = TextEditingController();
  }
}
